home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 22 / CU Amiga Magazine's Super CD-ROM 22 (1998)(EMAP Images)(GB)[!][issue 1998-05].iso / PowerPC / Programming / PPCsiod / SIOD / Substring.scm < prev    next >
Encoding:
Text File  |  1992-06-13  |  1.7 KB  |  54 lines

  1. (define (substring-CI<? x y z a b c)
  2.         (string-ci<? (substring x y z) (substring a b c)))
  3.  
  4. (define (substring-CI=? x y z a b c)
  5.         (string-ci=? (substring x y z) (substring a b c)))
  6.  
  7. (define (substring<? x y z a b c)
  8.         (string<? (substring x y z) (substring a b c)))
  9.  
  10. (define (substring=? x y z a b c)
  11.         (string=? (substring x y z) (substring a b c)))
  12.  
  13. (define (substring-fill! x y z a)
  14.         (while (< y z)
  15.                (string-set! x y a)
  16.                (set! y (1+ y)))
  17.         x)
  18.  
  19. (define (substring-move-left! x y z a b)
  20.         (while (< y z)
  21.                (string-set! x b (string-ref a y))
  22.                (set! b (1+ b))
  23.                (set! y (1+ y)))
  24.         x)
  25.  
  26. (define (substring-move-right! x y z a b)
  27.         (while (<= y z)
  28.                (set! z (-1+ z))
  29.                (string-set! x b (string-ref a z))
  30.                (set! b (1+ b)))
  31.         x)
  32.  
  33. (define (substring-find-next-char-in-set st s e c)
  34.         (define (ch-in-set c l)
  35.                 (do ((ptr l (cdr ptr)))
  36.                 ((or (null? ptr) (eq? (car ptr) c)) ptr)))
  37.         (if (char? c)
  38.             (set! c (list c))
  39.             (set! c (string->list c)))
  40.         (do ((i s (1+ i))) 
  41.             ((or (>= i e) (ch-in-set (string-ref st i) c))
  42.              (if (= i e) nil i))))
  43.  
  44. (define (substring-find-previous-char-in-set st s e c)
  45.         (define (ch-in-set c l)
  46.                 (do ((ptr l (cdr ptr)))
  47.                 ((or (null? ptr) (eq? (car ptr) c)) ptr)))
  48.         (if (char? c)
  49.             (set! c (list c))
  50.             (set! c (string->list c)))
  51.         (do ((i (-1+ e) (-1+ i))) 
  52.             ((or (< i s) (ch-in-set (string-ref st i) c))
  53.              (if (< i s) nil i))))
  54.